<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../public/layui/css/layui.css">
<link href="../../../../public/admin/css/style_v2.0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style_v2.0.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script>
    function showtable(dbname){
	   console.log(dbname);
       $.ajax({
	       url:"{:U('Admin/Database/showcreate')}",
		   dataType:'json',
		   data:{'db_name': dbname},
		   type:'get',
		   success:function(data){
		       console.log(data);
		   },
	   });
	}
</script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a> > <a href="{:U('web/account')}">数据库备份</a>  </div>
<div id="container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>数据库备份</legend>
</fieldset>
<div class="layui-form">
    <div class="layui-btn-group">
         <a href="" class="layui-btn layui-btn-big"><i class="layui-icon">&#xe60a;</i>账号列表</a>&nbsp;
         <button class="layui-btn layui-btn-big"  data-method="notice" ><i class="layui-icon">&#xe654;</i> 添加账号</button>&nbsp;
         <!--<a href="{:U('web/export/')}"  class="layui-btn layui-btn-big layui-btn-normal"><i class="layui-icon">&#xe62d;</i> 导出报表</a>&nbsp;-->
    </div>
</div>
<!--高级搜索-->
<div class="c"></div>
<div class="layui-form" style="background-color:#FFFFFF;">
<table class="layui-table" id="table">
    <thead>
    <tr style="text-align:center;">
      <th style="text-align:center;"></th>
      <th style="text-align:center;">表名</th>
      <th style="text-align:center;">备注</th>
      <th style="text-align:center;">类型</th>
      <th style="text-align:center;">编码</th>
      <th style="text-align:center;">记录数</th>
      <th style="text-align:center;">大小</th>
      <th colspan="2" style="text-align:center;">操作</th>
    </tr> 
    </thead>
    <form id="form2" name="form2" method="post" action="{:U('Admin/Database/backup/')}">  
     <volist name="list" id="r">
    <tr>
      <td  align="center" class="layui-form-item"><input type="checkbox" id="dbname[]" title=""  lay-skin="primary"  name="dbname[]" value="{$r.name}"/></td>
      <td align="center" height="22px">{$r.name}</td>
      <td align="center" height="22px">{$r.comment}</td>
      <td  align="center">{$r.engine}</td>
      <td  align="center">{$r.collation}</td>
      <td  align="center">{$r.rows}</td>
      <td  align="center">{$r.data_length}</td>
      <td  align="center">
      <a href="{:U('Admin/Database/optimize',array('db_name' => $r['name']))}">优化</a> |
      <a href="{:U('Admin/Database/repair',array('db_name' => $r['name']))}">修复</a> |
      <a href="#" onClick="showtable('{$r.name}');">结构</a></td>
    </tr>
    </volist>
    <tr>
      <td align="center"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></td>
      <td colspan="7">
      <div style="padding-left:20px;">  
         <input type="button" value="全选" name="selectall" class="layui-btn" />
         <input type="button" value="反选" name="selectno" class="layui-btn "/>
         <button  name="btnDel" lay-submit="" lay-filter="btnDel" class="layui-btn layui-btn-danger" />提交备份</button>
      </div>      </td>
    </tr>
   </form>
    </table>
    <div class="c"></div>
    <div id="pages">{$page}</div>      
</div>
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script>
//Demo
layui.use('form', function(){
  var form = layui.form;
   var active = {
       notice: function(){
		  layer.open({
			type: 1
			,title: '新增账号' //不显示标题栏
			,closeBtn: 2
			,area: ['600px','590px']
			,shade: 0.4
			,id: 'LAY_layuipro' //设定一个id，防止重复弹出
			//,btn: ['提交', '关闭']
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,content: $("#account_add"),
            })
       }
   }
   
    $('.layui-btn-group .layui-btn').on('click', function(){
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this, othis) : '';
	  });
   
  //监听提交
  form.on('submit(btnDel)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });

});
</script>
